package com.itheima.service.impl;

import com.github.pagehelper.PageHelper;
import com.itheima.mapper.StuMapper;
import com.itheima.pojo.Student;
import com.itheima.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StuServiceImpl implements StuService {
    @Autowired
    private StuMapper stuMapper;

    @Override
    public List<Student> findAll(Integer pageNum,Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        return stuMapper.findAll();
    }

    @Override
    public void save(Student student) {
        stuMapper.save(student);
    }

    @Override
    public void delete(Student student) {
        stuMapper.delete(student);
    }

    @Override
    public void update(Student student) {
        stuMapper.update(student);
    }

    @Override
    public Student findByNumber(String number) {

        Student student = stuMapper.findByNumber(number);

        return student;
    }
}
